From a80f7fc9097ba24759ebf724cd9da531cf34ca95 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Sat, 11 Oct 2003 08:09:11 +0000 Subject: [PATCH] bitkeeper revision 1.501.1.2 (3f87baa7GCRi_yatMEUW36MM6ZAyEQ) xen_refresh_dev.c: new file --- .rootkeys | 1 + extras/mini-os/Makefile | 1 + tools/misc/xen_refresh_dev.c | 49 ++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 tools/misc/xen_refresh_dev.c diff --git a/.rootkeys b/.rootkeys index de66e17a7d..b7f0367e0e 100644 --- a/.rootkeys +++ b/.rootkeys @@ -184,6 +184,7 @@ 3f13d81eQ9Vz-h-6RDGFkNR9CRP95g tools/misc/xen_nat_enable 3f13d81e6Z6806ihYYUw8GVKNkYnuw tools/misc/xen_nat_enable.README 3f1668d4F29Jsw0aC0bJEIkOBiagiQ tools/misc/xen_read_console.c +3f87ba90EUVPQLVOlFG0sW89BCwouQ tools/misc/xen_refresh_dev.c 3f72f1bdJPsV3JCnBqs9ddL9tr6D2g xen/COPYING 3f841450eJvqAD1Dldc0_aOweGiglQ xen/GUEST_CHANGES 3ddb79bcbOVHh38VJzc97-JEGD4dJQ xen/Makefile diff --git a/extras/mini-os/Makefile b/extras/mini-os/Makefile index f437cf2f58..18ae585db7 100644 --- a/extras/mini-os/Makefile +++ b/extras/mini-os/Makefile @@ -35,6 +35,7 @@ $(TARGET): hypervisor-ifs head.o $(OBJS) clean: find . -type f -name '*.o' | xargs rm -f rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz + find . -type l | xargs rm -f %.o: %.c $(HDRS) Makefile $(CC) $(CFLAGS) -c $< -o $@ diff --git a/tools/misc/xen_refresh_dev.c b/tools/misc/xen_refresh_dev.c new file mode 100644 index 0000000000..b9ea025c1f --- /dev/null +++ b/tools/misc/xen_refresh_dev.c @@ -0,0 +1,49 @@ +/****************************************************************************** + * xen_refresh_dev.c + * + * Refresh our view of a block device by rereading its partition table. This + * is necessary to synchronise with VBD attaches and unattaches in Xen. + * Currently there's no automatic plumbing of attach/unattach requests. + * + * Copyright (c) 2003, K A Fraser + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* BLKRRPART */ + +int main(int argc, char **argv) +{ + int fd; + + if ( argc != 2 ) + { + fprintf(stderr, "xen_refresh_dev \ne.g., /dev/xvda\n"); + return 1; + } + + if ( (fd = open(argv[1], O_RDWR)) == -1 ) + { + fprintf(stderr, "Error opening %s: %s (%d)\n", + argv[1], strerror(errno), errno); + return 1; + } + + if ( ioctl(fd, BLKRRPART) == -1 ) + { + fprintf(stderr, "Error executing BLKRRPART on %s: %s (%d)\n", + argv[1], strerror(errno), errno); + return 1; + } + + close(fd); + + return 0; +} -- 2.30.2